IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SaveAdvanceFundRequestUploadedDocumentMetadata]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SaveAdvanceFundRequestUploadedDocumentMetadata]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO



--SaveAdvanceFundRequestUploadedDocumentMetadata 41359, '2007A050059', 'Testing123.doc'

CREATE PROCEDURE [dbo].[SaveAdvanceFundRequestUploadedDocumentMetadata] 
(  
	@fwkDomainUserId	INT,
	@PropNumber	VARCHAR(50),
	@FileName	VARCHAR(2000)
)  
AS 

SET NOCOUNT ON
		
		INSERT INTO dbo.AdvanceFundRequestUploadedDocument (PropNumber, DateUploaded, UploadedBy, DocumentName)
					VALUES (@PropNumber, GETDATE(), @fwkDomainUserId, @FileName)
		
		SELECT TOP 1 Id FROM dbo.AdvanceFundRequestUploadedDocument 
		WHERE PropNumber = @PropNumber
		ORDER BY Id DESC 

GO